<template>
  <a-card>
    <a-row>
      <a-col :span="24">
        <a-form layout="inline" :form="form" @submit="handleSubmit">
          <a-form-item label="标签名称">
            <a-input placeholder="标签名称搜索" v-decorator="['name']"></a-input>
          </a-form-item>
          <a-form-item>
            <a-button type="primary" html-type="submit">搜索</a-button>
            <a-button type="primary" @click="resetForm" style="margin-left:10px">重置</a-button>
          </a-form-item>
        </a-form>
      </a-col>
    </a-row>
    <a-table
      bordered
      :columns="columns"
      :rowKey="record => record.id"
      :data-source="dataSource"
      :pagination="pagination"
      :scroll="{ x: true }"
      @change="handleTableChange"
    >
    </a-table>
  </a-card>
</template>
<script>
import { listMixin } from '../../util/listMixin'
import { postAction } from '@/api/manage'
const columns = [
  {
    title: 'code',
    width: 200,
    dataIndex: 'code'
    // slots: { title: 'customTitle' },
    // scopedSlots: { customRender: 'name' },
  },
  {
    title: 'id',
    width: 200,
    dataIndex: 'id'
    // slots: { title: 'customTitle' },
    // scopedSlots: { customRender: 'name' },
  },
  {
    title: '标签名称',
    width: 200,
    dataIndex: 'name'
  },
  // {
  //   title: '创建时间',
  //   width: 200,
  //   dataIndex: 'createTime'
  // }
  ]
export default {
  mixins: [listMixin],
  data() {
    return {
      columns,
      url:{
        list:'/jic-backend-operation/operate/collocation/lookLabel'
      }
    }
  },
  methods: {
    loadData(arg) {
      if (!this.url.list) {
        this.$message.error('请设置url.list属性!')
        return
      }
      //加载数据 若传入参数1则加载第一页的内容
      if (arg === 1) {
        this.pagination.current = 1
      }
      var params = this.getQueryParams() //查询条件
      params.code = 'B08-A01'
      postAction(this.url.list, params).then(res => {
        if (res.code == 200) {
          //update-end---author:wsp    Date:20210826
          this.dataSource = res.data.records || res.data
          if (res.data.total) {
            this.pagination.total = res.data.total
          } else {
            this.pagination.total = 0
          }
        } else {
          this.$message.warning(res.msg)
        }
        this.loading = false
      })
    }
  }
}
</script>
